.class public Lcom/netease/newsreader/appwidget/WidgetProvider_4_1;
.super Landroid/appwidget/AppWidgetProvider;
.source "WidgetProvider_4_1.java"


# static fields
.field private static final APPWIDGET_COMPONENT_NAME:Landroid/content/ComponentName; = null

.field private static final TAG:Ljava/lang/String; = "NewsReader--UpdateService"


# direct methods
.method static constructor <clinit>()V
    .locals 3

    .prologue
    .line 18
    new-instance v0, Landroid/content/ComponentName;

    .line 19
    const-string v1, "com.netease.newsreader.activity"

    .line 20
    const-string v2, "com.netease.newsreader.appwidget.WidgetProvider_4_1"

    .line 18
    invoke-direct {v0, v1, v2}, Landroid/content/ComponentName;-><init>(Ljava/lang/String;Ljava/lang/String;)V

    sput-object v0, Lcom/netease/newsreader/appwidget/WidgetProvider_4_1;->APPWIDGET_COMPONENT_NAME:Landroid/content/ComponentName;

    .line 14
    return-void
.end method

.method public constructor <init>()V
    .locals 0

    .prologue
    .line 14
    invoke-direct {p0}, Landroid/appwidget/AppWidgetProvider;-><init>()V

    return-void
.end method

.method private defaultAppWidget(Landroid/content/Context;[I)V
    .locals 3
    .parameter "context"
    .parameter "appWidgetIds"

    .prologue
    .line 37
    new-instance v0, Landroid/widget/RemoteViews;

    invoke-virtual {p1}, Landroid/content/Context;->getPackageName()Ljava/lang/String;

    move-result-object v1

    .line 38
    const v2, 0x7f030081

    .line 37
    invoke-direct {v0, v1, v2}, Landroid/widget/RemoteViews;-><init>(Ljava/lang/String;I)V

    .line 40
    .local v0, views:Landroid/widget/RemoteViews;
    const v1, 0x7f0c018e

    const/16 v2, 0x8

    invoke-virtual {v0, v1, v2}, Landroid/widget/RemoteViews;->setViewVisibility(II)V

    .line 41
    const v1, 0x7f0c01a8

    const/4 v2, 0x0

    invoke-virtual {v0, v1, v2}, Landroid/widget/RemoteViews;->setViewVisibility(II)V

    .line 44
    invoke-direct {p0, p1, v0}, Lcom/netease/newsreader/appwidget/WidgetProvider_4_1;->linkButtons(Landroid/content/Context;Landroid/widget/RemoteViews;)V

    .line 45
    invoke-direct {p0, p1, p2, v0}, Lcom/netease/newsreader/appwidget/WidgetProvider_4_1;->pushUpdate(Landroid/content/Context;[ILandroid/widget/RemoteViews;)V

    .line 46
    return-void
.end method

.method private linkButtons(Landroid/content/Context;Landroid/widget/RemoteViews;)V
    .locals 6
    .parameter "context"
    .parameter "views"

    .prologue
    const/high16 v5, 0x800

    const/4 v4, 0x0

    .line 51
    new-instance v2, Landroid/content/ComponentName;

    .line 52
    const-class v3, Lcom/netease/newsreader/appwidget/WidgetService4x1;

    .line 51
    invoke-direct {v2, p1, v3}, Landroid/content/ComponentName;-><init>(Landroid/content/Context;Ljava/lang/Class;)V

    .line 54
    .local v2, serviceName:Landroid/content/ComponentName;
    new-instance v0, Landroid/content/Intent;

    const-string v3, "com.netease.newsreader.activity.intent.action.APP_WIDGET_PREV"

    invoke-direct {v0, v3}, Landroid/content/Intent;-><init>(Ljava/lang/String;)V

    .line 55
    .local v0, intent:Landroid/content/Intent;
    invoke-virtual {v0, v2}, Landroid/content/Intent;->setComponent(Landroid/content/ComponentName;)Landroid/content/Intent;

    .line 56
    invoke-static {p1, v4, v0, v5}, Landroid/app/PendingIntent;->getService(Landroid/content/Context;ILandroid/content/Intent;I)Landroid/app/PendingIntent;

    move-result-object v1

    .line 57
    .local v1, pendingIntent:Landroid/app/PendingIntent;
    const v3, 0x7f0c0197

    invoke-virtual {p2, v3, v1}, Landroid/widget/RemoteViews;->setOnClickPendingIntent(ILandroid/app/PendingIntent;)V

    .line 59
    new-instance v0, Landroid/content/Intent;

    .end local v0           #intent:Landroid/content/Intent;
    const-string v3, "com.netease.newsreader.activity.intent.action.APP_WIDGET_NEXT"

    invoke-direct {v0, v3}, Landroid/content/Intent;-><init>(Ljava/lang/String;)V

    .line 60
    .restart local v0       #intent:Landroid/content/Intent;
    invoke-virtual {v0, v2}, Landroid/content/Intent;->setComponent(Landroid/content/ComponentName;)Landroid/content/Intent;

    .line 61
    invoke-static {p1, v4, v0, v5}, Landroid/app/PendingIntent;->getService(Landroid/content/Context;ILandroid/content/Intent;I)Landroid/app/PendingIntent;

    move-result-object v1

    .line 62
    const v3, 0x7f0c0195

    invoke-virtual {p2, v3, v1}, Landroid/widget/RemoteViews;->setOnClickPendingIntent(ILandroid/app/PendingIntent;)V

    .line 63
    return-void
.end method

.method private pushUpdate(Landroid/content/Context;[ILandroid/widget/RemoteViews;)V
    .locals 2
    .parameter "context"
    .parameter "appWidgetIds"
    .parameter "views"

    .prologue
    .line 67
    invoke-static {p1}, Landroid/appwidget/AppWidgetManager;->getInstance(Landroid/content/Context;)Landroid/appwidget/AppWidgetManager;

    move-result-object v0

    .line 69
    .local v0, gm:Landroid/appwidget/AppWidgetManager;
    if-eqz p2, :cond_0

    .line 70
    invoke-virtual {v0, p2, p3}, Landroid/appwidget/AppWidgetManager;->updateAppWidget([ILandroid/widget/RemoteViews;)V

    .line 74
    :goto_0
    return-void

    .line 72
    :cond_0
    sget-object v1, Lcom/netease/newsreader/appwidget/WidgetProvider_4_1;->APPWIDGET_COMPONENT_NAME:Landroid/content/ComponentName;

    invoke-virtual {v0, v1, p3}, Landroid/appwidget/AppWidgetManager;->updateAppWidget(Landroid/content/ComponentName;Landroid/widget/RemoteViews;)V

    goto :goto_0
.end method


# virtual methods
.method public onDeleted(Landroid/content/Context;[I)V
    .locals 2
    .parameter "context"
    .parameter "appWidgetIds"

    .prologue
    .line 88
    new-instance v0, Landroid/content/Intent;

    const-string v1, "com.netease.newsreader.appwidget.service.IMM_UPDATE_SERVICE_4_1"

    invoke-direct {v0, v1}, Landroid/content/Intent;-><init>(Ljava/lang/String;)V

    invoke-virtual {p1, v0}, Landroid/content/Context;->stopService(Landroid/content/Intent;)Z

    .line 89
    invoke-super {p0, p1, p2}, Landroid/appwidget/AppWidgetProvider;->onDeleted(Landroid/content/Context;[I)V

    .line 90
    return-void
.end method

.method public onDisabled(Landroid/content/Context;)V
    .locals 0
    .parameter "context"

    .prologue
    .line 83
    invoke-super {p0, p1}, Landroid/appwidget/AppWidgetProvider;->onDisabled(Landroid/content/Context;)V

    .line 84
    return-void
.end method

.method public onEnabled(Landroid/content/Context;)V
    .locals 0
    .parameter "context"

    .prologue
    .line 78
    invoke-super {p0, p1}, Landroid/appwidget/AppWidgetProvider;->onEnabled(Landroid/content/Context;)V

    .line 79
    return-void
.end method

.method public onReceive(Landroid/content/Context;Landroid/content/Intent;)V
    .locals 0
    .parameter "context"
    .parameter "intent"

    .prologue
    .line 24
    invoke-super {p0, p1, p2}, Landroid/appwidget/AppWidgetProvider;->onReceive(Landroid/content/Context;Landroid/content/Intent;)V

    .line 25
    return-void
.end method

.method public onUpdate(Landroid/content/Context;Landroid/appwidget/AppWidgetManager;[I)V
    .locals 2
    .parameter "context"
    .parameter "appWidgetManager"
    .parameter "appWidgetIds"

    .prologue
    .line 31
    invoke-direct {p0, p1, p3}, Lcom/netease/newsreader/appwidget/WidgetProvider_4_1;->defaultAppWidget(Landroid/content/Context;[I)V

    .line 33
    new-instance v0, Landroid/content/Intent;

    const-string v1, "com.netease.newsreader.appwidget.service.IMM_UPDATE_SERVICE_4_1"

    invoke-direct {v0, v1}, Landroid/content/Intent;-><init>(Ljava/lang/String;)V

    invoke-virtual {p1, v0}, Landroid/content/Context;->startService(Landroid/content/Intent;)Landroid/content/ComponentName;

    .line 34
    return-void
.end method
